<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--

-->
<div id="app">
    <button @click="list.push('喜羊羊')">添加一个项</button>
    <button @click="list.pop()">删除一个项</button>
<!--    利用索引值改变数组时，不能被侦听到。-->
    <ul>
        <li v-for="item in list">
            {{item}}
        </li>
    </ul>
</div>
<script src="../../js/vue.js"></script>
<script>
    new Vue({
        el:'#app',
        data:{
            list:['露娜','韩信','怒娜','万战']
        },
        list(newVal,oldVal){
            console.log('数组改变了',newVal,oldVal);
        }
    })
</script>
</body>
</html>